package ${package.Controller};

import ${package.Service}.${table.serviceName};
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import ${package.Other}.${entity}AddDTO;
import ${package.Other}.${entity}UpdateDTO;
import ${package.Other}.${entity}QueryDTO;
import ${package.Parent}.vo.${entity}QueryVO;
import ${package.Parent}.vo.${entity}PageVO;
import com.github.pagehelper.PageInfo;
<#if restControllerStyle>
import org.springframework.web.bind.annotation.RestController;
<#else>
import org.springframework.stereotype.Controller;
</#if>
<#if superControllerClassPackage??>
import ${superControllerClassPackage};
</#if>
import java.util.List;

/**
 * ${table.comment!} Controller接口类
 *
 * @author ${author}
 * @date ${date}
 */
<#if restControllerStyle>
@RestController
<#else>
@Controller
</#if>
@RequestMapping("/<#if controllerMappingHyphenStyle>${controllerMappingHyphen}<#else>${table.entityPath}</#if>")
<#if kotlin>
class ${table.controllerName}<#if superControllerClass??> : ${superControllerClass}()</#if>
<#else>
<#if superControllerClass??>
public class ${table.controllerName} extends ${superControllerClass} {
<#else>
public class ${table.controllerName} {
</#if>

    private final ${table.serviceName} baseService;

    public ${table.controllerName}(${table.serviceName} baseService) {
        this.baseService = baseService;
    }

   /**
    * 新增
    *
    * @param: addDto
    * @return: Object
    * @author ${author}
    * @date ${date}
    */
    @PostMapping("/add")
    public Object add(@Validated @RequestBody ${entity}AddDTO addDto) {
        return baseService.add(addDto);
    }

   /**
    * 删除
    *
    * @param: ids
    * @return: Object
    * @author ${author}
    * @date ${date}
    */
    @PostMapping("/deletes")
    public Object deletes(@RequestBody List<String> ids) {
        return baseService.deletes(ids);
    }

   /**
    * 修改
    *
    * @param: updateDto
    * @return: Object
    * @author ${author}
    * @date ${date}
    */
    @PostMapping("/edit")
    public Object edit(@Validated @RequestBody ${entity}UpdateDTO updateDto) {
        return baseService.edit(updateDto);
    }

   /**
    * 分页查询
    *
    * @param: queryDto
    * @return: Object
    * @author ${author}
    * @date ${date}
    */
    @GetMapping("/queryPage")
    public PageInfo<${entity}PageVO> page(${entity}QueryDTO queryDto) {
        return baseService.page(queryDto);
    }

   /**
    * 详情
    *
    * @param: id
    * @return: Object
    * @author ${author}
    * @date ${date}
    */
    @GetMapping("/detail")
    public ${entity}QueryVO detail(String id) {
        return baseService.detail(id);
    }

}
</#if>
